//
//  YJWTextField.m
//  百思不得骑姐
//
//  Created by YJW on 16/11/1.
//  Copyright © 2016年 yijiang. All rights reserved.
//

#import "YJWTextField.h"
#import <objc/runtime.h>

#define YJWColorKeyPath @"_placeholderLabel.textColor"

@implementation YJWTextField

-(instancetype)init
{
    if ((self = [super init]) == nil) {
        
    }
    return self;
}

-(void)awakeFromNib
{
    [super awakeFromNib];
    
    [self resignFirstResponder];
    
    self.tintColor = self.textColor;
}

-(BOOL)becomeFirstResponder
{
    [super becomeFirstResponder];
    [self setValue:[UIColor whiteColor] forKeyPath:YJWColorKeyPath];
    return YES;
}

-(BOOL)resignFirstResponder
{
    [super resignFirstResponder];
    [self setValue:[UIColor lightGrayColor] forKeyPath:YJWColorKeyPath];
    return YES;
}

@end

